package springcloud.easybuy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springcloud.easybuy.dao.EasybuyProductCategoryDao;
import springcloud.easybuy.entity.EasybuyProduct;
import springcloud.easybuy.entity.EasybuyProductCategory;

import java.util.List;

@Controller
@RequestMapping("/ProductCategory/provider")
@ResponseBody
public class EasybuyProductCategoryController {


    @Autowired
    private EasybuyProductCategoryDao easybuyProductCategoryDao;


    @RequestMapping("/queryAllProductCategory")
    public List<EasybuyProductCategory> queryAllProduct(){
        return easybuyProductCategoryDao.findAll();
    }


    @RequestMapping("/queryByParentId/{id}")
    public List<EasybuyProductCategory> queryAllProductCategory(@PathVariable("id") int id){
        return easybuyProductCategoryDao.findByParentId(id);
    }
}
